package com.example.printservice.constants;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class Constants {

    public static String FILE_PATH;
    public static List<String> PRINTER_NAMES;
    public static String RESULT_PATH;

    public static String SERVER_URL;
    public static List<String> FILE_TYPES;

    @Value("${constants.resultPath}")
    public void setResultPath(String resultPath) {
        RESULT_PATH = resultPath;
    }

    @Value("${constants.filePath}")
    public void setFilePath(String filePath) {
        FILE_PATH = filePath;
    }

    @Value("#{'${constants.printerNames:}'.empty ? null : '${constants.printerNames:}'.split(',')}")
    public void setPrinterNames(List<String> printerNames) {
        PRINTER_NAMES = printerNames;
    }

    @Value("#{'${constants.fileTypes:}'.empty ? null : '${constants.fileTypes:}'.split(',')}")
    public void setFileTypes(List<String> fileTypes) {
        FILE_TYPES = fileTypes;
    }

    @Value("${constants.serverUrl}")
    public void setServerUrl(String serverUrl) {
        Constants.SERVER_URL = serverUrl;
    }
}
